<%- include('common/header') %>
<%- include('common/nav')%>

<h1 class="text-center color"><a href="/main"><%= title %></a></h1>
<p class="text-center">Welcome to <%= title %></p>
<% include common/note.ejs %>
<div class="horizontal-centrol padding-20 margin-top-20" style="position: relative">
    <p class="lg-font underline">留言</p>
    <% if(note_info.comment != ''){%>
    <%  note_info.comment.forEach(function(comment){ %>
    <div class="float-left padding-right-10">
        <a href="/note/<%=  comment.user[0]._id  %>/"><img src="<%= comment.user[0].img %>" class="sm-img" /></a>
    </div>
    <div class="float-left ">
        <div>
            <a id="<%= comment._id %>" onclick="del_comment('<%= comment._id %>','<%= user %>','<%= note_info._id %>')"  class="del-a <%= user == comment.user[0]._id ? '' : 'hide' %>">删除</a>
            <span class="padding-right-10 font-weight" > <a href="/note/<%=  comment.user[0]._id  %>/"><%= comment.user[0].user %></a></span>
            <span class="padding-right-10 color-1"><%= comment.created_at %></span>
        </div>
        <p><%= comment.content %></p>
    </div>
    <div style="clear: both"></div>
    <% }) %>
    <% }%>
    <form id="comment">
        <div class="form-group">
            <input type="text" class="hide"  name="note_id" value="<%= note_info._id %>"/>
        </div>
        <div class="form-group">
            <input type="text" class="hide"  name="user" value="<%= user %>"/>
        </div>
        <div class="form-group">
            <textarea rows="6" name="content" class="form-control"></textarea>
        </div>
    </form>
    <button class="btn btn-primary" onclick="send_comment('<%= user %>','<%= note_info._id %>')">留言</button>
</div>
<script type="text/javascript" src="/javascripts/comment.js"></script>
<%- include('common/footer') %>